<div>
  <form class="form-horizontal" role="form" novalidate name="myForm" ng-init="initQuery()">
    <div class="form-ctrl md-whiteframe-z1">
      <div class="form-search" style="height:280px;" ng-class="{true: 'shou'}[shoumun.num==0]" ng-switch
           on="sendData.timeType">
        <div>
          <label style="width:70px">业务线</label>
          <md-select ng-model="sendData.businessLine" >
            <md-select-label>
              {{sendData.businessLine ? _getNames(sendData.businessLine,'businessLineName') :'全部'}}
            </md-select-label>
            <md-option ng-value="" ng-click="getBL()">全部</md-option>
            <md-option ng-value="item" ng-repeat="item in pageBind.businessLine"ng-click="getBL()">{{item.businessLineName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="width:70px">接入渠道</label>
          <md-select multiple ng-model="sendData.channel" disabled ng-if="!close.channel">
            <md-select-label>全部</md-select-label>
          </md-select>
          <md-select multiple ng-model="sendData.channel" ng-if="close.channel">
            <md-select-label>
              {{sendData.channel.length ? _getNames(sendData.channel,'channelName',accessChannels) :'全部'}}
            </md-select-label>
            <md-option ng-value="" ng-click="_checkAll(sendData,'channel')">全部</md-option>
            <md-option ng-value="channel" ng-repeat="channel in accessChannels">{{channel.channelName}}</md-option>
          </md-select>
        </div>
         <div>
          <label style="width:70px">交易类型</label>
          <md-select multiple ng-model="sendData.tradeTypeCode" disabled ng-if="!close.tradeType">
            <md-select-label>全部</md-select-label>
          </md-select>
          <md-select multiple ng-model="sendData.tradeTypeCode"  ng-if="close.tradeType">
            <md-select-label>
              {{sendData.tradeTypeCode.length ? _getNames(sendData.tradeTypeCode,'tradeTypeName',tradeTypes) :'全部'}}
            </md-select-label>
            <md-option ng-value="" ng-click="_checkAll(sendData,'tradeTypeCode')">全部</md-option>
            <md-option ng-value="tradeType" ng-repeat="tradeType in tradeTypes">{{tradeType.tradeTypeName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="width:70px">交易状态</label>
          <md-select ng-model="sendData.tradeStateCode" placeholder="充值成功">
            <!-- <md-select-label>
              {{sendData.tradeStateCode ? _getNames(sendData.tradeStateCode,'tradeStateName') :'全部'}}
            </md-select-label> -->
            <md-option ng-value="">全部</md-option>
            <md-option ng-value="tradeState.tradeStateCode" ng-repeat="tradeState in tradeStates">{{tradeState.tradeStateName}}</md-option>
          </md-select>
        </div>
        <div>
        <md-switch ng-change="changeDiffTime()" ng-model="sendData.diffTime">{{diffTime}}</md-switch>
        </div>
        <div>
          <label style="width:70px">省公司</label>
          <md-select multiple ng-model="sendData.provinceCode" placeholder="全部">
            <md-select-label>
              {{sendData.provinceCode.length ? getNames(sendData.provinceCode,'provinceName',pageBind.provinces,sendData.diffTime):pro}}
            </md-select-label>
            <md-option ng-value="" ng-click="provinceCheckAll(sendData,'provinceCode','全部(汇总)')">全部(汇总)</md-option>
            <md-option ng-value=""  ng-show="showPro" ng-click="provinceCheckAll(sendData,'provinceCode','全部(分省)')">全部(分省)</md-option>
            <md-option ng-value="item" ng-repeat="item in pageBind.provinces" ng-click="diffPro(item.provinceCode)">{{item.provinceName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="width:70px">机构</label>
          <md-select multiple ng-model="sendData.organization" disabled ng-if="!close.organization">
            <md-select-label>全部</md-select-label>
          </md-select>
          <md-select multiple ng-model="sendData.organization" ng-if="close.organization">
            <md-select-label>
              {{sendData.organization.length ? _getNames(sendData.organization,'organizationName',agencyData.agencys) :'全部'}}
            </md-select-label>
            <md-option ng-value="" ng-click="_checkAll(sendData,'organization')">全部</md-option>
            <md-option ng-value="agency" ng-repeat="agency in agencyData.agencys">{{agency.organizationName}}</md-option>
          </md-select>
        </div>
        <div>
          <label style="">账期</label>
          <md-select ng-model="sendData.timeType" placeholder="日">
            <md-option ng-value="item.timeTypeCode" ng-repeat="item in pageBind.timeTypes" ng-click="changeTime(item.timeTypeCode)">{{item.timeTypeName}}</md-option>
          </md-select>
        </div>
        <div ng-switch-when="5">
          <md-input-container flex>
            <label>开始时间</label>
            <input type="number" ng-model="sendData.startTime"  time-validate="year" end-time="sendData.endTime"  required name="startYear">
            <div ng-messages="myForm.startYear.$error" >
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间不应大于结束时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container>
        </div>
        <div ng-switch-when="5">
          <md-input-container flex>
            <label>结束时间</label>
            <input type="number" ng-model="sendData.endTime"  time-validate="year" start-time="sendData.startTime" required name="endYear">
            <div ng-messages="myForm.endYear.$error" >
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间不应大于结束时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container>
        </div>
        <div ng-switch-when="1">
          <md-input-container flex>
            <label>开始时间</label>
            <input type="date" ng-model="sendData.startTime"  time-validate="day" end-time="sendData.endTime" required
                   name="startDate">
            <div ng-messages="myForm.startDate.$error" >
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间不应大于结束时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container>
        </div>
        <div ng-switch-when="1">
          <md-input-container flex>
            <label>结束时间</label>
            <input type="date" ng-model="sendData.endTime"  time-validate="day" start-time="sendData.startTime" required
                   name="endDate">
            <div ng-messages="myForm.endDate.$error" >
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间不应大于结束时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container>
        </div>
        <div ng-switch-when="3">
          <md-input-container flex>
            <label>开始时间</label>
            <input type="month" ng-model="sendData.startTime"  time-validate="month" end-time="sendData.endTime" required
                   name="startMonth">
            <div ng-messages="myForm.startMonth.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间不应大于结束时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container>
        </div>
        <div ng-switch-when="3">
          <md-input-container flex>
            <label>结束时间</label>
            <input type="month" ng-model="sendData.endTime"  time-validate="month" start-time="sendData.startTime"
                   required name="endMonth">
            <div ng-messages="myForm.endMonth.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间不应大于结束时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container>
        </div>
        <input-quarter-group ng-switch-when="4" start-time="sendData.startTime" end-time="sendData.endTime"></input-quarter-group>
      </div>
      <i class="glyphicon glyphicon-chevron-up shrinkage" ng-show="!btnDisabled && showArrow" ng-click="shoumun.num=0"></i>
      <md-button ng-disabled="myForm.$invalid"  ng-click="shoumun.num==1?shoumun.num=0:shoumun.num=1;search()" class="md-fab md-primary md-hue-1" aria-label="Profile"> <i class="glyphicon glyphicon-arrow-down"
      style="margin-top:28px;"  ng-show="shoumun.num==0"></i>
        <i class="glyphicon glyphicon-search" ng-show="shoumun.num==1"></i>
      </md-button>
    </div>
  </form>
  <div class="table-info">
    <div class="menus" ng-show="flag === 'view' || flag === 'table' || flag === 'table1' ">
      <md-button ng-click="back()" ng-show="showBack" class="md-raised ico-btn">返回</md-button>
      <span ng-show="showBack" class="division"></span>

      <md-button aria-label="列表" ng-click="changeTable()" class="md-raised ico-btn">
        <img src="images/tables.png"></md-button>
      <md-button aria-label="图表" ng-click="changeView()" class="md-raised ico-btn">
        <img src="images/charts.png"></md-button>

      <form action="{{formPrefix}}" target="_black" method="post" style="display: initial;">
        <input type="hidden" name="data" value="{{outData}}">
        <md-button type="submit" class="md-raised">导出Excel</md-button>
      </form>
    </div>
    <!--echarts显示-->
    <div ng-show="flag === 'view'">
      <div id="doc" style="height:450px;"></div>
    </div>
    <!--当交易状态为全部的时候显示的表格-->
    <div ng-show="flag === 'table'">
      <div class="table-detail">
        <div class="t_r">
          <table class="table table-bordered">
            <caption style="text-align:center;font-size:large;font-weight:bold;color:black">{{title}}</caption>
            <thead>
              <tr>
                <th width="10%" ng-show="send.diffTime === 'false'">账期</th>
                <th width="10%" ng-show="send.diffTime === 'true'">时刻</th>
                <th width="9%">业务线</th>
                <th width="9%" ng-show="channel">接入渠道</th>
                <th width="8%" ng-show="tradeType">交易类型</th>
                <th width="10%" ng-show="organization">机构</th>
                <th width="7%" ng-class="{dropup:showSeq}" class="cursor" ng-click="proSeq(sumItems)">
                  省公司
                  <span class="caret" ng-show="firstQuery && send.diffPro === '2'"></span>
                </th>
                <th width="8%">状态</th>
                <th width="13%" ng-class="{dropup:seqBus}" class="cursor"  ng-click="diffBusNum(sumItems)">
                  业务量(笔)
                  <span class="caret" ng-show="send.diffTime !== 'true' && firstQuery"></span>
                </th>
                <th width="13%">订单金额(元)</th>
                <th width="13%">充值金额(元)</th>
              </tr>
            </thead>
            <tbody class="table table-bordered">
              <tr ng-repeat="item in sumItems" class="cursor"  ng-click="depDown(item)">
                <td class="table-ellipsis " width="10%"  title="{{item.time}}"><a>{{item.time}}</a></td>
                <td class="table-ellipsis" width="9%"  title="{{item.businessLineName}}"><a>{{item.businessLineName}}</a></td>
                <td width="9%" class="table-ellipsis" ng-show="channel"  title="{{item.channelName}}"><a>{{item.channelName}}</a></td>
                <td class="table-ellipsis" width="8%" ng-show="tradeType" title="{{item.tradeTypeName}}"><a>{{item.tradeTypeName}}</a></td>
                <td width="10%" class="table-ellipsis" ng-show="organization"  title="{{item.organizationName}}"><a>{{item.organizationName}}</a></td>
                <td class="table-ellipsis" width="7%" title="{{item.provinceName}}"><a>{{item.provinceName}}</a></td>
                <td width="8%" title="{{item.tradeStateName}}"><a>{{item.tradeStateName}}</a></td>
                <td width="13%" title="{{item.businessNum}}"><a>{{item.businessNum}}</a></td>
                <td width="13%" title="{{item.orderAmount}}"><a>{{item.orderAmount}}</a></td>
                <td width="13%" title="{{item.rechargeAmount}}"><a>{{item.rechargeAmount}}</a></td>
              </tr>
              <tr class="summary">
                <td width="10%">汇总</td>
                <td width="9%" ></td>
                <td width="9%"  ng-show="channel"></td>
                <td width="8%" ng-show="tradeType"></td>
                <td width="10%"  ng-show="organization"></td>
                <td width="7%"></td>
                <td width="8%"></td>
                <td width="13%" title="{{sum.businessNum}}">{{sum.businessNum}}</td>
                <td width="13%" title="{{sum.orderAmount}}">{{sum.orderAmount}}</td>
                <td width="13%" title="{{sum.rechargeAmount}}">{{sum.rechargeAmount}}</td>
              </tr>
              <tr class="summary">
                <td width="10%">{{avgName}}均值</td>
                <td width="9%"></td>
                <td width="9%"  ng-show="channel"></td>
                <td width="8%" ng-show="tradeType"></td>
                <td width="10%"  ng-show="organization"></td>
                <td width="7%"></td>
                <td width="8%"></td>
                <td width="13%" title="{{avgSumBusinessNum}}">{{avgSumBusinessNum}}</td>
                <td width="13%" title="{{avgSumOrderAmount}}">{{avgSumOrderAmount}}</td>
                <td width="13%" title="{{avgSumRechargeAmount}}">{{avgSumRechargeAmount}}</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <!--当交易状态为单选的时候显示的表格-->
    <div ng-show="flag === 'table1'">
      <div class="table-detail" >
        <div class="t_r" style="overflow-x: scroll;">
          <table class="table table-bordered" style="min-width: 100%;max-width: none;table-layout: fixed;word-break:break-all;">
            <caption style="text-align:center;font-size:large;font-weight:bold;color:black">{{title}}
            </caption>
            <thead>
              <tr>
                <th width="169px;" rowspan="2" ng-show="send.diffTime === 'false'">账期</th>
                <th width="169px;" rowspan="2" ng-show="send.diffTime === 'true'">时刻</th>
                <th width="89px;" rowspan="2">业务线</th>
                <th width="89px;" rowspan="2" ng-show="channel">接入渠道</th>
                <th width="89px;" rowspan="2" ng-show="tradeType">交易类型</th>
                <th width="89px;" rowspan="2" ng-show="organization">机构</th>
                <th width="70px;" rowspan="2" ng-class="{dropup:showSeq}" class="cursor" ng-click="proSeq(items)">省公司<span class="caret" ng-show=" firstQuery && send.diffPro === '2'"></span></th>
                <th colspan="3" width="380px">业务量(笔)</th>
                <th colspan="3" width="380px">订单金额(元)</th>
                <th colspan="3" width="380px">充值金额(元)</th>
              </tr>
              <tr>
                <th>总业务量</th>
                <th>成功量</th>
                <th>失败量</th>
                <th>总订单金额</th>
                <th width="103px;">成功订单金额</th>
                <th>失败订单金额</th>
                <th>总充值金额</th>
                <th>成功充值金额</th>
                <th>失败充值金额</th>
              </tr>
            </thead>
            <tbody>
              <tr ng-repeat="item in items" class="cursor" ng-click="depDown(item)">
                <td class="table-ellipsis" width="169px;" title="{{item.time}}"><a>{{item.time}}</a></td>
                <td class="table-ellipsis" width="89px;" title="{{item.businessLineName}}"><a>{{item.businessLineName}}</a></td>
                <td  width="89px;" class="table-ellipsis" title="{{item.channelName}}"  ng-show="channel"><a>{{item.channelName}}</a></td>
                <td class="table-ellipsis" width="89px;" title="{{item.tradeTypeName}}" ng-show="tradeType"><a>{{item.tradeTypeName}}</a></td>
                <td width="89px;" class="table-ellipsis" title="{{item.organizationName}}"  ng-show="organization"><a>{{item.organizationName}}</a></td>
                <td class="table-ellipsis" width="70px;" title="{{item.provinceName}}"><a>{{item.provinceName}}</a></td>
                <td title="{{item.successTotal}}"><a>{{item.successTotal}}</a></td>
                <td title="{{item.busSuccess}}"><a>{{item.busSuccess}}</a></td>
                <td title="{{item.busFail}}"><a>{{item.busFail}}</a></td>
                <td title="{{item.orderTotal}}"><a>{{item.orderTotal.toFixed(2)}}</a></td>
                <td width="103px;" title="{{item.orderSuccess}}"><a>{{item.orderSuccess.toFixed(2)}}</a></td>
                <td title="{{item.orderFail}}"><a>{{item.orderFail.toFixed(2)}}</a></td>
                <td title="{{item.rechargeTotal}}"><a>{{item.rechargeTotal.toFixed(2)}}</a></td>
                <td title="{{item.rechargeSuccess}}"><a>{{item.rechargeSuccess.toFixed(2)}}</a></td>
                <td title="{{item.rechargeFail}}"><a>{{item.rechargeFail.toFixed(2)}}</a></td>
              </tr>
              <tr class="summary">
                <td>汇总</td>
                <td></td>
                <td></td>
                <td ng-show="channel"></td>
                <td ng-show="tradeType"></td>
                <td ng-show="organization"></td>
                <td title="{{t1}}"  ng-repeat="t1 in sumTotal track by $index">{{t1}}</td>
              </tr>
              <tr class="summary">
                <td>{{avgName}}均值</td>
                <td></td>
                <td></td>
                <td ng-show="channel"></td>
                <td ng-show="tradeType"></td>
                <td ng-show="organization"></td>
                <td colspan="3" title="{{avgSumBusinessNum}}">{{avgSumBusinessNum}}</td>
                <td colspan="3" title="{{avgSumOrderAmount}}">{{avgSumOrderAmount}}</td>
                <td colspan="3" title="{{avgSumRechargeAmount}}">{{avgSumRechargeAmount}}</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>